<html>
<head>
    <meta charset="UTF-8">
    <title>考勤</title>
</head>
<body>
<script type="text/javascript" src="./$.js"></script>
<script>
    require(['!this.js'], $$.load)
</script>
</body>
</html>
<template data-name="this.htm">
    <div>
        <head_top :head="menu_top"></head_top>
        <div class="contaniner">
            <div class="sidebar">
                <menu_child :nav_data="menu_child"></menu_child>
            </div>
            <div class="main-content">
                <div class="main">
                    <div class="tab-wrap">
                        <div class="main_hd no-tab">
                            <h2>同步管理</h2>
                        </div>
                    </div>
                    <div class="plugins_wrp">
                        <p class="plugin_desc">你可以点击执行下列同步功能，丰富企业号能力和体验</p>
                        <ul id="js_plugins">
                            <li class="item_wrp">
                                <a class="plugin_item" @click="syn('/sys/dpt/sync')">
                                    <div class="plugin_content">
                                        <h3 class="title">同步部门</h3>
                                        <p class="desc">该功能同步微信部门数据到本地部门表。</p>
                                    </div>
                                </a>
                            </li>
                            <li class="item_wrp">
                                <a class="plugin_item" @click="syn('/sys/user/sync')">
                                    <div class="plugin_content">
                                        <h3 class="title">同步微信员工</h3>
                                        <p class="desc">该功能同步微信成员数据到本地成员表。</p>
                                    </div>
                                </a>
                            </li>
                            <li class="item_wrp">
                                <a class="plugin_item" @click="syn('/sys/user/sync_kq')">
                                    <div class="plugin_content">
                                        <h3 class="title">推送员工到考勤机</h3>
                                        <p class="desc">该功能将本地部门、成员表同步到考勤系统。</p>
                                    </div>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <foot></foot>
    </div>
</template>

<script data-name="this.js">
    function get_data(callback, url) {
        $$.ajax({
            url: url,
            result: {
                $200: function (data) {
                    $$.toast.hide();
                    callback(data);
                }
            }
        });
    }
    require('../$res/js/common');
    module.exports = {
        template: require('!this.htm'),
        methods: {
            syn: function (url) {
                $$.toast.show();
                get_data(function () {
                    $$.alertTips.show('同步成功')
                }, url)
            }
        },
        components: {
            'foot': $$.foot
        },
        loaded: function () {
            $$.m = {
                data: false
            };
            $$.init_comps.head();
            $$.init_comps.menu();
        }
    };
</script>
